<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.ym.b2b.cache.configcache.WebAppConfig"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@ taglib prefix="b" uri="/b2b-tags"%>
<script type="text/javascript" src="views/jsp/xcimage/Common.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<style type="text/css">

/*隐藏盒子设置*/
div.hidden-box{width:133px;position:absolute;display:none; top:29px;filter:alpha(opacity=80); -moz-opacity:0.8; opacity:0.8;}
.hidden-box>ul{list-style-type:none;color:#fff;cursor:pointer; padding-top:12px;padding-bottom:15px}
.hidden-box>ul li{ line-height:30px; height:30px; font-weight:500}
.hidden-box>ul li a:hover{background:#643519;color:#fff}

/*隐藏盒子位置设置*/
.hidden-loc-index{left:81px}
.hidden-loc-us{left:166px}
.box03{left:249px}
.box04{left:333px}
.box06{left:501px}

</style>

<div id="automv" class="automv">
<b:showNews outResponseAttrName="pd" limitRow="2"  isScroll="1" getType="list" />
<c:forEach items="${pd.rows}" var="pdlist">
<a href="javascript:hidePC()">
	<img src="http://111.39.26.6:1800/admin/uploadPackage/plupload/img/ad/cb.gif"> 
</a>
<a href="<c:url value="/news/showNewsDetail.s" />?newsId=${pdlist.newsId}&newsTypeId=${pdlist.newsTypeId}" >
	<div style="float:left; margin:10px; margin-top: 0" >
		<c:if test="${not empty  pdlist.smallPic}">
			<img src="<%=WebAppConfig.getPicPath() %>${pdlist.smallPic}" width="100" height="100"> 
			<p style="text-align:left;width:100px;font-size:14px; color:red">
			 	${pdlist.newsTitle }
			 </p>
		</c:if>
		<c:if test="${empty  pdlist.smallPic}">
			<p style="text-align:left;width:100px;font-size:14px; color:red">
			 	${pdlist.newsTitle}
			 </p>
		</c:if>
	</div>
</a>
</c:forEach>
<%-- <%-- <b:getKey outResponseAttrName="pc" key="PC-01" type="xc" />	
	<c:forEach items="${pc.rows }" var="pclist">
			<div style="float:left; margin:10px; margin-top: 0" >
				<c:if test="${not empty  pclist.value}">
					<img  src="${pclist.value }" width="180" height="180" border="0">
					<p style="text-align:center;width:180px;font-size:18px; color:red">
					 	${pclist.notes }
					 </p>
				</c:if>
				<c:if test="${empty  pclist.value}">
					<p style="text-align:center;width:360px;font-size:18px; color:red">
					 	${pclist.notes }
					 </p>
				</c:if>
			</div>
	</c:forEach> --%>
</div>

<div id="nav" >
	<ul class="nav-main">
		<li class="dq"><a style="width:53px;" href="<c:url value="/showIndex.s" />">首页</a></li>
		<li id = "li-1"><a href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=41" />">关于我们</a></li>
		<li id = "li-2"><a href="<c:url value="/views/jsp/cms/news/index_d.jsp" />">新闻动态</a></li>
		<li id = "li-3"><a href="<c:url value="/views/jsp/cms/help/_xc_index_d.jsp?id=ZS" />">质量管理</a></li>
		<li id = "li-4"><a href="<c:url value="/product/searchProduct.s" />">商品信息</a></li>
		<li id = "li-5"><a href="<c:url value="/news/searchPromoProductNews.s?newsTypeId=278" />">促销品种</a></li>
		<li id = "li-6" ><a href="<c:url value="/views/jsp/center/c_user_center.jsp" />">客户服务</a></li>
		<li id = "li-7" ><a href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=271" />">联系我们</a></li>
		<c:choose>
			<c:when test="${not empty sessionScope.WEB_USER_TOKEN}">
				<li id = "li-8" ><a href="###" onclick="layer.feedBack()" style="margin-left: 2px;">用户反馈</a></li>
			</c:when>
			<c:otherwise>
				<li id = "li-8" ><a href="<c:url value="/views/jsp/login.jsp" />"  style="margin-left: 2px;">用户反馈</a></li>
			</c:otherwise>
		</c:choose>
		<li id = "li-9" ><a href="<c:url value="http://www.ahxcyy.com/Member/yplxcx.aspx" />">供应商流向下载</a></li>
	</ul>
</div>
<%-- <div class="nav_right fr" style="width: 243px;">
	<a href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=271" />">联系我们</a>
	<a href="###" onclick="layer.feedBack()" style="margin-left: 2px;">用户反馈</a>
</div> --%>
<!--隐藏盒子-->
<div id="box-1" class="hidden-box hidden-loc-index" style="display: none">
	<ul>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=41" />">公司简介</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/_xc_index_d.jsp?id=GSYP" />">公司一瞥</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=263" />">企业文化</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/_xc_index_d.jsp?id=RYZS" />">荣誉证书</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/index_d.jsp?id=265" />">组织机构</a></li>
	</ul>
</div>
<div id="box-2" class="hidden-box hidden-loc-us" style="display: none">
	<ul>
		<li><a style="width:84px;" href="<c:url value="/news/searchPageNews.s?newsTypeId=241" />">公司新闻</a></li>
		<li><a style="width:84px;" href="<c:url value="/news/searchPageNews.s?newsTypeId=33" />">行业咨询</a></li>
	</ul>
</div>
<div id="box-3" class="hidden-box hidden-loc-info box03" style="display: none">
	<ul>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/_xc_index_d.jsp?id=ZZZS" />">资质证书</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/cms/help/_xc_index_d.jsp?id=ZLBZ" />">质量保障</a></li>
	</ul>
</div>
<div id="box-4" class="hidden-box hidden-loc-info box04"
	style="display: none">
	<ul>
		<li><a style="width:84px;" href="<c:url value="/product/searchProduct.s" />">可供品种</a></li>
		<li><a style="width:84px;" href="<c:url value="/product/searchCommendProduct.s" />">推荐品种</a></li>
		<%-- <li><a style="width:84px;" href="<c:url value="/brand/showBrandIndex.s" />">品牌专区</a></li>
		<li><a style="width:84px;" href="<c:url value="/product/searchProduct.s?orderByType=NEW_PRODUCT" />">新品上市</a></li> --%>
	</ul>
</div>
<div id="box-6" class="hidden-box hidden-loc-info box06"
	style="display: none">
	<ul>
		<%-- <li><a style="width:84px;" href="<c:url value="/views/jsp/center/sale/c_s_sale_details.jsp" />">流向查询</a></li> --%>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/center/other/c_searchBatchPaper_list.jsp" />">检验单下载</a></li>
		<li><a style="width:84px;" href="<c:url value="/views/jsp/center/other/c_searchBatchPaper_list.jsp" />">首营资料下载</a></li>
	</ul>
</div>
<script>
	$(function() {
		$('.automv').moveAuto({angle:-Math.PI/4, speed:120});
	    var num;
	    $('.nav-main>li[id]').hover(function(){
	        /*下拉框出现*/
	        var Obj = $(this).attr('id');
	        num = Obj.substring(3, Obj.length);
	        $('#box-'+num).slideDown(150);
	    } ,function(){
	        $('#box-'+num).hide();
	    } );
//	    hidden-box hover e
 	    $('.hidden-box').hover(function(){
	        $(this).show();
	    },function(){
	        $(this).slideUp(200);
	    }); 
	});
	function setFocus(num) {
		$("#nav ul li").removeClass("dq");
		$("#nav ul li").eq(num).addClass("dq");
	}
	var dialogFeedBack;
	var feedBackhtml;
	var feedBackpage = {};
	feedBackpage.url = '<c:url value="/views/jsp/include/dialog_feedback.jsp" />';
	feedBackpage.ok = function(datas) {
		feedBackhtml = datas;
	};
	if (feedBackhtml) {
		feedBackpage.html = feedBackhtml;
	}
	layer.feedBack = function(options) {
		options = options || {};
		dialogFeedBack = $.layer({
			type : 1,
			title : '用户反馈',
			offset : [ ($(window).height() - 360) / 2 + 'px', '' ],
			border : [ 5, 0.5, '#666' ],
			area : [ '550px', '400px' ],
			shadeClose : true,
			page : feedBackpage
		});
	};
	!function($){
        /**
        * Description: jquery飘窗插件，可自适应浏览器宽高的变化
        * Author: YZCS
        * CreateTime: 2015-04-25
        * param: args={startL:default, startT:default, angle:-Math.PI/4, speed: 125} 
        * 参数说名: startL飘窗初始时距离左边的距离, startT飘窗初始化距离顶部的距离, angle飘窗初始运动方向, speed运动速度(px/s)
        * CopyRight: GPL 
        */
        $.fn.moveAuto = function(args){
            //先定义一些工具函数判断边距
            function isTop(pos, w_w, w_h, d_w, d_h){//飘窗到达上边距
                if(pos.top<=0){
                    return true;
                }else{
                    return false;
                }
            }
            function isBottom(pos, w_w, w_h, d_w, d_h){//飘窗到达下边距
                if(pos.top>=(w_h-d_h)){
                    return true;
                }else{
                    return false;
                }
            }
            function isLeft(pos, w_w, w_h, d_w, d_h){//飘窗到达左边距
                if(pos.left<=0){
                    return true;
                }else{
                    return false;
                }
            }
            function isRight(pos, w_w, w_h, d_w, d_h){//飘窗到达右边距
                if(pos.left>=(w_w-d_w)){
                    return true;
                }else{
                    return false;
                }
            }
            return this.each(function(){
                var w_w = parseInt($(window).width()),
                    d_w = parseInt($(this).width()),
                    w_h = parseInt(600),
                    d_h = parseInt(100),
                    d_l = 0,
                    d_t = (w_h-d_h)/20,
                    max_l = w_w - d_w;
                    max_t = w_h - d_h;
                    //位置及参数的初始化 startL飘窗初始时距离左边的距离, startT飘窗初始化距离顶部的距离
                var setobj = $.extend({startL:d_l, startT:d_t, angle:Math.PI/4, speed:100}, args);
                $(this).css({position: 'absolute', left: setobj['startL']+'px', top: setobj['startT']+'px'});
                var position = {left: setobj['startL'], top: setobj['startT']};//飘窗位置对象
                var that = $(this);
                var angle= setobj.angle;
                var time = 10;//控制飘窗运动效果，值越小越细腻
                var step = setobj.speed * (time/1000);//计算运动步长
                var decoration = {x:step*Math.cos(angle), y:step*Math.sin(angle)};//计算二维上的运动增量
                var mvtid;
                $(window).on('resize', function(){//窗口大小变动时重新设置运动相关参数
                    w_w = parseInt($(window).width()),
                    w_h = parseInt($(window).height()),
                    max_l = w_w - d_w;
                    max_t = 100;
                });
                function move(){
                    position.left += decoration.x;
                    position.top  += decoration.y;
                    if(isLeft(position, w_w, w_h, d_w, d_h)||isRight(position, w_w, w_h, d_w, d_h)){
                        decoration.x = -1*decoration.x;
                    }
                    if(isRight(position, w_w, w_h, d_w, d_h)){
                        position.left = max_l;
                    }
                     if(isTop(position, w_w, w_h, d_w, d_h)||isBottom(position, w_w, w_h, d_w, d_h)){
                        decoration.y = -1*decoration.y;
                    }
                    if(isBottom(position, w_w, w_h, d_w, d_h)){
                        position.top = max_t;
                    } 
                    //that.css({left:position.left, top:position.top});
                    that.animate({left:position.left, top:position.top}, time);//改用jquery动画函数使其更加平滑
                    mvtid = setTimeout(move, time);//递归调用，使飘窗连续运动
                }
                move();//触发动作
                that.on('mouseenter', function(){ clearTimeout(mvtid) });//添加鼠标事件
                that.on('mouseleave', function(){ move() });
            });
        }//end plugin definition
        }(jQuery);
        
    function hidePC(){
		$("#automv").hide();
  	}
</script>
	
 